<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>用户中心 | 时刻报警服务平台</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="${staticPath}/userend/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="${staticPath}/userend/i/app-icon72x72@2x.png">
    <meta name="apple-mobile-web-app-title" content="Amaze UI" />
    <link rel="stylesheet" href="${staticPath}/userend/css/amazeui.min.css" />
    <link rel="stylesheet" href="${staticPath}/userend/css/admin.css">
    <link rel="stylesheet" href="${staticPath}/userend/css/app.css">

    <link rel="stylesheet" href="${staticPath}/layui/css/layui.css" />
    <script type="text/javascript" src="${staticPath}/layui/layui.js"></script>

</head>

<body data-type="index">


    <header class="am-topbar am-topbar-inverse admin-header">
        <div class="am-topbar-brand">
            <a href="javascript:;" class="tpl-logo">
                <img src="${staticPath}/userend/img/logo.png" alt="">
            </a>
        </div>
        <div class="am-icon-list tpl-header-nav-hover-ico am-fl am-margin-right">

        </div>

        <button class="am-topbar-btn am-topbar-toggle am-btn am-btn-sm am-btn-success am-show-sm-only" data-am-collapse="{target: '#topbar-collapse'}"><span class="am-sr-only">导航切换</span> <span class="am-icon-bars"></span></button>

        <div class="am-collapse am-topbar-collapse" id="topbar-collapse">

            <ul class="am-nav am-nav-pills am-topbar-nav am-topbar-right admin-header-list tpl-header-list">
                <li class="am-dropdown" data-am-dropdown data-am-dropdown-toggle>
                    <a class="am-dropdown-toggle tpl-header-list-link" href="javascript:;">
                        <span class="am-icon-bell-o"></span> 提醒 <span class="am-badge tpl-badge-success am-round">5</span></span>
                    </a>
                    <ul class="am-dropdown-content tpl-dropdown-content">
                        <li class="tpl-dropdown-content-external">
                            <h3>你有 <span class="tpl-color-success">5</span> 条提醒</h3><a href="###">全部</a></li>
                        <li class="tpl-dropdown-list-bdbc"><a href="#" class="tpl-dropdown-list-fl"><span class="am-icon-btn am-icon-plus tpl-dropdown-ico-btn-size tpl-badge-success"></span> 【预览模块】移动端 查看时 手机、电脑框隐藏。</a>
                            <span class="tpl-dropdown-list-fr">3小时前</span>
                        </li>
                        <li class="tpl-dropdown-list-bdbc"><a href="#" class="tpl-dropdown-list-fl"><span class="am-icon-btn am-icon-check tpl-dropdown-ico-btn-size tpl-badge-danger"></span> 移动端，导航条下边距处理</a>
                            <span class="tpl-dropdown-list-fr">15分钟前</span>
                        </li>
                        <li class="tpl-dropdown-list-bdbc"><a href="#" class="tpl-dropdown-list-fl"><span class="am-icon-btn am-icon-bell-o tpl-dropdown-ico-btn-size tpl-badge-warning"></span> 追加统计代码</a>
                            <span class="tpl-dropdown-list-fr">2天前</span>
                        </li>
                    </ul>
                </li>
                <li class="am-hide-sm-only"><a href="javascript:;" id="admin-fullscreen" class="tpl-header-list-link"><span class="am-icon-arrows-alt"></span> <span class="admin-fullText">开启全屏</span></a></li>

                <li class="am-dropdown" data-am-dropdown data-am-dropdown-toggle>
                    <a class="am-dropdown-toggle tpl-header-list-link" href="javascript:;">
                        <span class="tpl-header-list-user-nick">${appUser.realName}</span><span class="tpl-header-list-user-ico"> <img src="${staticPath}/userend/img/user01.png"></span>
                    </a>
                    <ul class="am-dropdown-content">
                        <li><a href="javascript:jumpUrl('${ctx}/userend/person-info')"><span class="am-icon-bell-o"></span> 个人资料</a></li>
                        <li><a href="javascript:jumpUrl('${ctx}/userend/modify-password')"><span class="am-icon-cog"></span> 修改密码</a></li>
                        <li><a href="javascript:logout()"><span class="am-icon-power-off"></span> 退出</a></li>
                    </ul>
                </li>
                <li><a href="javascript:logout()" class="tpl-header-list-link"><span class="am-icon-sign-out tpl-header-list-ico-out-size"></span></a></li>
            </ul>
        </div>
    </header>







    <div class="tpl-page-container tpl-page-header-fixed">


        <div class="tpl-left-nav tpl-left-nav-hover">
            <div class="tpl-left-nav-title">
                菜单列表
            </div>
            <div class="tpl-left-nav-list">
                <ul class="tpl-left-nav-menu" id="indexMenu">
                    <#--<li class="tpl-left-nav-item">-->
                        <#--<a href="javascript:jumpUrl('${ctx}/userend/home')" class="nav-link active">-->
                            <#--<i class="am-icon-home"></i>-->
                            <#--<span>首页</span>-->
                        <#--</a>-->
                    <#--</li>-->
                    <#--<li class="tpl-left-nav-item">-->
                        <#--<a href="chart.html" class="nav-link tpl-left-nav-link-list">-->
                            <#--<i class="am-icon-bar-chart"></i>-->
                            <#--<span>数据表</span>-->
                            <#--<i class="tpl-left-nav-content tpl-badge-danger"> 12 </i>-->
                        <#--</a>-->
                    <#--</li>-->

                    <#--<li class="tpl-left-nav-item">-->
                        <#--<a href="javascript:;" class="nav-link tpl-left-nav-link-list">-->
                            <#--<i class="am-icon-table"></i>-->
                            <#--<span>表格</span>-->
                            <#--<i class="am-icon-angle-right tpl-left-nav-more-ico am-fr am-margin-right"></i>-->
                        <#--</a>-->
                        <#--<ul class="tpl-left-nav-sub-menu">-->
                            <#--<li>-->
                                <#--<a href="table-font-list.html">-->
                                    <#--<i class="am-icon-angle-right"></i>-->
                                    <#--<span>文字表格</span>-->
                                    <#--<i class="am-icon-star tpl-left-nav-content-ico am-fr am-margin-right"></i>-->
                                <#--</a>-->

                                <#--<a href="table-images-list.html">-->
                                    <#--<i class="am-icon-angle-right"></i>-->
                                    <#--<span>图片表格</span>-->
                                    <#--<i class="tpl-left-nav-content tpl-badge-success"> 18 </i>-->

                                    <#--<a href="javascript:jumpUrl('${ctx}/userend/notices')">-->
                                        <#--<i class="am-icon-angle-right"></i>-->
                                        <#--<span>系统公告</span>-->
                                        <#--<i class="tpl-left-nav-content tpl-badge-primary"> 5 </i>-->


                                        <#--<a href="form-news-list.html">-->
                                            <#--<i class="am-icon-angle-right"></i>-->
                                            <#--<span>文字列表</span>-->

                                        <#--</a>-->
                            <#--</li>-->
                        <#--</ul>-->
                    <#--</li>-->

                    <#--<li class="tpl-left-nav-item">-->
                        <#--<a href="javascript:;" class="nav-link tpl-left-nav-link-list">-->
                            <#--<i class="am-icon-wpforms"></i>-->
                            <#--<span>表单</span>-->
                            <#--<i class="am-icon-angle-right tpl-left-nav-more-ico am-fr am-margin-right tpl-left-nav-more-ico-rotate"></i>-->
                        <#--</a>-->
                        <#--<ul class="tpl-left-nav-sub-menu" style="display: block;">-->
                            <#--<li>-->
                                <#--<a href="form-amazeui.html">-->
                                    <#--<i class="am-icon-angle-right"></i>-->
                                    <#--<span>Amaze UI 表单</span>-->
                                    <#--<i class="am-icon-star tpl-left-nav-content-ico am-fr am-margin-right"></i>-->
                                <#--</a>-->

                                <#--<a href="form-line.html">-->
                                    <#--<i class="am-icon-angle-right"></i>-->
                                    <#--<span>线条表单</span>-->
                                <#--</a>-->
                            <#--</li>-->
                        <#--</ul>-->
                    <#--</li>-->

                    <#--<li class="tpl-left-nav-item">-->
                        <#--<a href="login.html" class="nav-link tpl-left-nav-link-list">-->
                            <#--<i class="am-icon-key"></i>-->
                            <#--<span>登录</span>-->

                        <#--</a>-->
                    <#--</li>-->
                </ul>
            </div>
        </div>

        <div class="tpl-content-wrapper">

            <iframe id="contentFrame" scrolling="no" onload="iframeLoad()" src="${ctx}/userend/home" style="width:100%;"></iframe>

        </div>

    </div>


    <script src="${staticPath}/userend/js/jquery.min.js"></script>
    <script src="${staticPath}/userend/js/amazeui.min.js"></script>
    <script src="${staticPath}/userend/js/index.js"></script>

    <script src="${staticPath}/admin/tcsf/wg_listToTree1.1.js"></script>

    <div class="am-modal am-modal-confirm" tabindex="-1" id="confirm">
        <div class="am-modal-dialog">
            <div class="am-modal-hd"></div>
            <div class="am-modal-bd">

            </div>
            <div class="am-modal-footer">
                <span class="am-modal-btn" data-am-modal-cancel>取消</span>
                <span class="am-modal-btn" data-am-modal-confirm>确定</span>
            </div>
        </div>
    </div>

<script type="text/javascript">
    layui.use('layim', function(layim){
        //基础配置
        layim.config({

            title : '${appUser.realName}',

            min : true,

            isAudio : true,

            isVideo : true,

            notice : true,

            isfriend : true,

            isgroup : true,

            init: {
                url: '${ctx}/userend/webim/init-info' //接口地址（返回的数据格式见下文）
                ,type: 'get' //默认get，一般可不填
                ,data: {

                } //额外参数
            } //获取主面板列表信息，下文会做进一步介绍

            //获取群员接口（返回的数据格式见下文）
            ,members: {
                url: '${ctx}/userend/webim/members' //接口地址（返回的数据格式见下文）
                ,type: 'get' //默认get，一般可不填
                ,data: {} //额外参数
            }

            //上传图片接口（返回的数据格式见下文），若不开启图片上传，剔除该项即可
            ,uploadImage: {
                url: '' //接口地址
                ,type: 'post' //默认post
            }

            //上传文件接口（返回的数据格式见下文），若不开启文件上传，剔除该项即可
            ,uploadFile: {
                url: '' //接口地址
                ,type: 'post' //默认post
            }
            //扩展工具栏，下文会做进一步介绍（如果无需扩展，剔除该项即可）
            ,tool: [{
                alias: 'code' //工具别名
                ,title: '代码' //工具名称
                ,icon: '&#xe64e;' //工具图标，参考图标文档
            }]

            ,msgbox: layui.cache.dir + 'css/modules/layim/html/msgbox.html' //消息盒子页面地址，若不开启，剔除该项即可
            ,find: layui.cache.dir + 'css/modules/layim/html/find.html' //发现页面地址，若不开启，剔除该项即可
            ,chatLog: layui.cache.dir + 'css/modules/layim/html/chatlog.html' //聊天记录页面地址，若不开启，剔除该项即可
        });
    });


    var progress = $.AMUI.progress;

    $(function() {

        $('#contentFrame').load(function() {
            progress.done();
        });

        $('#indexMenu').delegate('li', 'click', function() {
            if($(this).find('ul').length == 0) {
                $('#indexMenu li>a').removeClass('active');
                var link = $(this).children('a');
                link.addClass('active');
                var url = link.attr('url');
                jumpUrl(url);
            }
            return false;
        });

        //  菜单
        $.get('${ctx}/userend/menu', function(resp) {
            var param = {
                list: resp,
                inParams:{
                    pid:"parentId",
                    rootId : null,
                    id:'id'
                },
                outParams:{
                    children:"children",
                    pid:"pid",
                    id:'id'
                },
                sort:{
                    orderBy:["sort"],
                    sort:"asc"
                }
            };
            var tree = wg_listToTree(param);

            var html = renderMenu(tree);
            $('#indexMenu').html(html);

        }, 'json');
    });

    function renderMenu(tree, sub) {
        var html = '';
        for(var i = 0 ; i < tree.length; i ++ ) {
            var node = tree[i];

            if(node.children && node.children.length > 0) {
                if(!sub) {
                    html += '<li class="tpl-left-nav-item">';
                    html += '<a href="javascript:void(0);" class="nav-link tpl-left-nav-link-list">';
                }else {
                    html += '<li>';
                    html += '<a href="javascript:void(0);">';
                }
            }else {
                if(!sub) {
                    html += '<li class="tpl-left-nav-item">';
                    html += '<a href="javascript:void(0);" url="' + node.url + '" class="nav-link tpl-left-nav-link-list">';
                }else {
                    html += '<li>';
                    html += '<a href="javascript:void(0);" url="' + node.url + '">';
                }
            }

            if(!sub) {
                html += '<i class="' + node.iconCls + '"></i> ';
            }else {
                html += '<i class="am-icon-angle-right"></i> ';
            }
            html += '<span>' + node.name + '</span>';
            if(node.children && node.children.length > 0) {
                html += '<i class="am-icon-angle-right tpl-left-nav-more-ico am-fr am-margin-right"></i>';
            }
            html += '</a>';
            if(node.children && node.children.length > 0) {
                html += '<ul class="tpl-left-nav-sub-menu">';
                html += renderMenu(node.children, true);
                html += '</ul>';
            }
            html += '</li>';
        }
        return html;
    }

    function logout() {
        confirm('提示', ' 您确定要退出吗？', function(options) {
            $.get('${ctx}/userend/logout', function(r) {
                location.href = '${ctx}/userend/login';
            }, 'json');
        });
    }

    function confirm(title, content, onConfirm, onCancel) {
        if(!onCancel) {
            onCancel = function() {

            };
        }
        $('#confirm .am-modal-hd').html(title);
        $('#confirm .am-modal-bd').html(content);
        $('#confirm').modal({
            relatedTarget: this,
            onConfirm: onConfirm,
            // closeOnConfirm: false,
            onCancel: onCancel
        });

    }

    function iframeLoad() {
        document.getElementById("contentFrame").height = 0;
        document.getElementById("contentFrame").height = document.getElementById("contentFrame").contentWindow.document.body.scrollHeight;
    }


    function jumpUrl(url) {
        progress.start();
        $('#contentFrame').attr('src', url);

        iframeLoad();
    }



</script>
</body>

</html>